package com.aspose.cells;

import java.util.ArrayList;
import java.util.Iterator;

class zakw implements zahc {
   private ziw c;
   private zif d;
   private int e;
   private zaky f;
   private zaky g;
   ArrayList a = new ArrayList();
   boolean b = false;
   private boolean h = true;
   private boolean i = true;
   private boolean j = false;
   private boolean k = false;

   zakw(zif var1, Object var2, int var3) {
      this.c = new ziw(var1, var2, var3);
      this.d = var1;
      this.e = 4;
      this.f = new zaky(var1);
      this.g = new zaky(var1);
   }

   zif c() {
      return this.d;
   }

   ziw d() {
      return this.c;
   }

   public zagc a() {
      return this.c;
   }

   public int e() {
      return this.e;
   }

   public void a(int var1) {
      this.e = var1;
   }

   zaky f() {
      return this.g;
   }

   public zahd b() {
      return this.f;
   }

   zaky g() {
      return this.f;
   }

   boolean h() {
      return this.h;
   }

   void c(boolean var1) {
      this.h = var1;
   }

   public boolean i() {
      return this.i;
   }

   public void a(boolean var1) {
      this.i = var1;
   }

   int j() {
      return this.c.h() != null ? zbuk.c((double)this.c.C()) : 0;
   }

   int k() {
      boolean var1 = false;
      if (this.c.h() != null) {
         int var2 = zbuk.c((double)(this.c.C() * 0.25F));
         return var2 < 3 ? 3 : var2;
      } else {
         return 0;
      }
   }

   int l() {
      boolean var1 = false;
      if (this.c.h() != null) {
         int var2 = zbuk.c((double)(this.c.C() * 0.2F));
         return var2 < 2 ? 2 : var2;
      } else {
         return 0;
      }
   }

   int m() {
      boolean var1 = false;
      float var2 = 0.0F;
      com.aspose.cells.b.a.b.zg var3 = this.c.i();
      float var4 = var3.h();
      if (var4 <= 1.0F) {
         return 1;
      } else if (var4 <= 3.0F) {
         return 2;
      } else if (var4 <= 4.0F) {
         return 3;
      } else if (var4 <= 6.0F) {
         return 4;
      } else if (var4 <= 7.0F) {
         return 5;
      } else if (var4 <= 8.0F) {
         return 6;
      } else {
         var2 = 0.465F;
         if (var3 != null) {
            int var5 = zbuk.c((double)(this.c.C() * var2));
            return var5 < 3 ? 3 : var5;
         } else {
            return 0;
         }
      }
   }

   int n() {
      return this.s() ? 36 : 27;
   }

   com.aspose.cells.b.a.b.zt o() {
      return new com.aspose.cells.b.a.b.zt((float)this.n(), this.c.C());
   }

   float p() {
      float var1 = 0.0F;
      if (this.c.h() != null) {
         var1 = this.c.C() * 0.25F;
         if (var1 < 2.0F) {
            var1 = 2.0F;
         }

         return -var1;
      } else {
         return 0.0F;
      }
   }

   float q() {
      float var1 = 0.0F;
      float var2 = 0.01F;
      if (this.c.h().h() <= 6.0F) {
         var2 = 0.0F;
      } else {
         var2 += this.c.h().h() * 0.02F;
      }

      if (this.c.h() != null) {
         var1 = this.c.C() * var2;
         if (var1 > 10.0F) {
            var1 = 10.0F;
         }

         return -var1;
      } else {
         return 0.0F;
      }
   }

   public void b(boolean var1) {
      this.j = var1;
   }

   private boolean s() {
      Iterator var1 = this.f().iterator();

      while(var1.hasNext()) {
         zala var2 = (zala)var1.next();
         if (var2.h() == 1) {
            zbcp var3 = var2.i();
            if (var3 != null && !var2.b() && var3.ak() && var3.z().b().b() != 6) {
               return true;
            }
         } else {
            zbtt var4 = var2.j();
            if (var4 != null && !var2.b() && var4.d().b().b() != 6) {
               return true;
            }
         }
      }

      return false;
   }

   protected void finalize() throws Exception {
      this.d(false);
   }

   public void r() {
      this.d(true);
      com.aspose.cells.b.a.zg.a(this);
   }

   protected void d(boolean var1) {
      if (!this.k) {
         if (var1) {
            if (this.c != null) {
               this.c.E();
            }

            Iterator var2;
            zala var3;
            if (this.g != null) {
               var2 = this.g.iterator();

               while(var2.hasNext()) {
                  var3 = (zala)var2.next();
                  var3.k();
               }
            }

            if (this.f != null) {
               var2 = this.f.iterator();

               while(var2.hasNext()) {
                  var3 = (zala)var2.next();
                  var3.k();
               }
            }
         }

         this.k = true;
      }

   }
}
